import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface GetHintDimension_ {
  /**
   * @description content
   */
  content?: string;
  /**
   * @description modelId
   * @format int32
   */
  modelId: number;
}
export interface GetHintDimensionEnum_ {
  /**
   * @description content
   */
  content?: string;
  /**
   * @description dimensionId
   * @format int32
   */
  dimensionId: number;
  /**
   * @description modelId
   * @format int32
   */
  modelId: number;
}
export interface GetHintMetrics_ {
  /**
   * @description content
   */
  content?: string;
  /**
   * @description modelId
   * @format int32
   */
  modelId: number;
}
export interface GetHisLog_ {
  /**
   * @description taskHisId
   * @format int32
   */
  taskHisId: number;
}
export interface GetHisStatus_ {
  /**
   * @description taskHisId
   * @format int32
   */
  taskHisId?: number;
}
export interface GetModelDetailById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetTableData_ {
  /**
   * @description modelId
   * @format int32
   */
  modelId: number;
  /**
   * @description pageSize
   * @format int32
   */
  pageSize: number;
}
export interface GetTaskDetailById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetTaskHisDataDownload_ {
  /**
   * @description hisIds
   */
  hisIds: number[];
}

export class TaskManager {
  /**
   * 删除任务
   *
   * @tags 任务管理
   * @request POST: /task-manager/del-task
   * @secure
   */
  postDelTask = (delDataDTO: defs.TaskDelDataDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager/del-task`,
      method: "POST",
      data: delDataDTO,
      ...params,
    });

  /**
   * 删除历史数据
   *
   * @tags 任务管理
   * @request POST: /task-manager/del-task-his
   * @secure
   */
  postDelTaskHis = (delDataDTO: defs.TaskDelDataDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager/del-task-his`,
      method: "POST",
      data: delDataDTO,
      ...params,
    });

  /**
   * 手动执行
   *
   * @tags 任务管理
   * @request POST: /task-manager/exec-task
   * @secure
   */
  postExecTask = (delDataDTO: defs.TaskDelDataDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager/exec-task`,
      method: "POST",
      data: delDataDTO,
      ...params,
    });

  /**
   * 手动执行历史
   *
   * @tags 任务管理
   * @request POST: /task-manager/exec-task-his
   * @secure
   */
  postExecTaskHis = (delDataDTO: defs.TaskDelDataDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager/exec-task-his`,
      method: "POST",
      data: delDataDTO,
      ...params,
    });

  /**
   * 取数任务时模糊搜索维度
   *
   * @tags 任务管理
   * @request GET: /task-manager/hint-dimension
   * @secure
   */
  getHintDimension = (
    query: { content?: string; modelId: number } | GetHintDimension_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListModelColumnInfoDimensionVO>({
      url: `/task-manager/hint-dimension`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 获取枚举维度
   *
   * @tags 任务管理
   * @request GET: /task-manager/hint-dimension-enum
   * @secure
   */
  getHintDimensionEnum = (
    query: { content?: string; dimensionId: number; modelId: number } | GetHintDimensionEnum_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListOptionVO>({
      url: `/task-manager/hint-dimension-enum`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 取数任务时模糊搜索指标
   *
   * @tags 任务管理
   * @request GET: /task-manager/hint-metrics
   * @secure
   */
  getHintMetrics = (query: { content?: string; modelId: number } | GetHintMetrics_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListModelColumnInfoMetricsVO>({
      url: `/task-manager/hint-metrics`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 日志记录
   *
   * @tags 任务管理
   * @request GET: /task-manager/his-log
   * @secure
   */
  getHisLog = (query: { taskHisId: number } | GetHisLog_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager/his-log`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 查询历史状态
   *
   * @tags 任务管理
   * @request GET: /task-manager/his-status
   * @secure
   */
  getHisStatus = (query: { taskHisId?: number } | GetHisStatus_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager/his-status`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 历史数据列表
   *
   * @tags 任务管理
   * @request POST: /task-manager/list-data
   * @secure
   */
  postListData = (taskDataDTO: defs.TaskDataDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager/list-data`,
      method: "POST",
      data: taskDataDTO,
      ...params,
    });

  /**
   * 模型信息详情
   *
   * @tags 任务管理
   * @request GET: /task-manager/model-detail/{id}
   * @secure
   */
  getModelDetailById = ({ id }: { id: number } | GetModelDetailById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityFetchModelDetailVO>({
      url: `/task-manager/model-detail/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 模型列表
   *
   * @tags 任务管理
   * @request POST: /task-manager/model-list
   * @secure
   */
  postModelList = (metricsSearchDTO: defs.FecthNumModelSearchDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityPageInfoModelDataVo>({
      url: `/task-manager/model-list`,
      method: "POST",
      data: metricsSearchDTO,
      ...params,
    });

  /**
   * 预览数据
   *
   * @tags 任务管理
   * @request POST: /task-manager/preview-data
   * @secure
   */
  postPreviewData = (taskPreviewDataDTO: defs.TaskCreateDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager/preview-data`,
      method: "POST",
      data: taskPreviewDataDTO,
      ...params,
    });

  /**
   * 保存任务
   *
   * @tags 任务管理
   * @request POST: /task-manager/save-task
   * @secure
   */
  postSaveTask = (taskCreateDTO: defs.TaskCreateDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager/save-task`,
      method: "POST",
      data: taskCreateDTO,
      ...params,
    });

  /**
   * 预览表里数据
   *
   * @tags 任务管理
   * @request GET: /task-manager/table-data
   * @secure
   */
  getTableData = (query: { modelId: number; pageSize: number } | GetTableData_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager/table-data`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 取数任务详情
   *
   * @tags 任务管理
   * @request GET: /task-manager/task-detail/{id}
   * @secure
   */
  getTaskDetailById = ({ id }: { id: number } | GetTaskDetailById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityTaskDetailVO>({
      url: `/task-manager/task-detail/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 任务历史
   *
   * @tags 任务管理
   * @request POST: /task-manager/task-his
   * @secure
   */
  postTaskHis = (taskHisSearchDTO: defs.TaskHisSearchDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager/task-his`,
      method: "POST",
      data: taskHisSearchDTO,
      ...params,
    });

  /**
   * 取数任务历史数据下载
   *
   * @tags 任务管理
   * @request GET: /task-manager/task-his/data/download
   * @secure
   */
  getTaskHisDataDownload = (query: { hisIds: number[] } | GetTaskHisDataDownload_, params: AxiosRequestConfig = {}) =>
    http.request<void>({
      url: `/task-manager/task-his/data/download`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 任务列表
   *
   * @tags 任务管理
   * @request POST: /task-manager/task-list
   * @secure
   */
  postTaskList = (taskSearchDTO: defs.TaskSearchDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager/task-list`,
      method: "POST",
      data: taskSearchDTO,
      ...params,
    });

  /**
   * 修改任务
   *
   * @tags 任务管理
   * @request POST: /task-manager/update-task
   * @secure
   */
  postUpdateTask = (taskCreateDTO: defs.TaskCreateDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityTaskInfo>({
      url: `/task-manager/update-task`,
      method: "POST",
      data: taskCreateDTO,
      ...params,
    });
}

export default new TaskManager();
